package client.controller;

import client.service.IHelloTestService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chengyadong
 * @date 2023/11/28 10:06
 * @description 测试类
 */
@RestController
@RequestMapping("/helloTest")
public class HelloTestController {
	@Autowired
	IHelloTestService helloTestService;

	@RequestMapping("/test")
	public String test(HttpServletRequest request) {
		return "client";
	}

	//查询数据库
	@RequestMapping("/query")
	public Map query(HttpServletRequest request) {
		return helloTestService.query();
	}

	@PutMapping("/update")
	public Map update() {
		return helloTestService.update();
	}

	//远程调用资源服务器
	@GetMapping("/queryByResource")
	public Map queryByResource(HttpServletRequest request) {
		return helloTestService.queryByResource(request);
	}
}
